< previous page page_362 next page >

Page 362
0362-01.jpg
Figure 9.23.
Viewing Recordset property lists.
Note.gif
The details of defining relationships are covered next week in the chapters on advanced SQL (Days 15 and 16). For now, remember that you can use the Relation object to create and maintain database relationships within Visual Basic code.

The final coding example for today is to create a new database, add two tables, define fields and indexes for those two tables, and then define a relationship object for the table pair. This example calls on most of the concepts you have learned today. Add one more button to the project. Set its Name property to cmdRelation and its Caption property to Re&lation. Add the code in Listing 9.24 to the cmdRelation_Click event window.
Type.gifListing 9.24. Coding the cmdRelation_Click event.
Private Sub cmdRelations_Click()
    '
    ' demonstrate relationship objects
    '
    On Error Resume Next
    '
    Dim ws As Workspace
    Dim db As Database

 
< previous page page_362 next page >

If you like this book, buy it!